package org.example.utils.codeGenerator;

import com.baomidou.mybatisplus.generator.config.INameConvert;
import com.baomidou.mybatisplus.generator.config.po.TableField;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import org.jetbrains.annotations.NotNull;

public class CustomNameConverter implements INameConvert {

    @Override
    public @NotNull String propertyNameConvert(@NotNull TableField field) {
        // 自定义字段名转属性名逻辑
        return NamingStrategy.capitalFirst(NamingStrategy.underlineToCamel(field.getName()));
    }

    @Override
    public @NotNull String entityNameConvert(@NotNull TableInfo tableInfo) {
        // 自定义表名转类名逻辑
        return NamingStrategy.capitalFirst(NamingStrategy.underlineToCamel(tableInfo.getName()));
    }
}
